Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Not bad, hit you most of all the learning goals here with some problems, you can see my comments for more information.
Take a look at my comments and let me know if you have any questions.
| #Time complexity: O(n+m) | ||
| #Space complexity: O(n) | ||
| def intersection(list1, list2) |
| #Time complexity: O(n+m+l) | ||
| #Space complexity: O(n^2) | ||
|
|
||
| def palindrome_permutation?(string) |
There was a problem hiding this comment.
The time complexity is O(n^2) because unshift has O(n) and you're doing it n times. The space complexity O(n) as well.
You seem to be trying to check to see if the string is a palindrome. The problem states that you are checking to see if the letters could be re-arranged into a palindrome.
There was a problem hiding this comment.
Ah...I went back to see the problem. I misunderstood the problem. My mind was thinking about the palindrome that I did a few weeks ago.
| #Time complexity: O(n+m) | ||
| #Space complexity: O(n) | ||
| def permutations?(string1, string2) |
There was a problem hiding this comment.
This will fail for heelo and hello. You should instead count the number of times each letter occurs.
No description provided.